//
//  WHWHFishSpotDetailVC.m
//  WHEasyBizLink
//
//  Created by ShengMeng on 9/25/25.
//

#import "WHFishSpotDetailVC.h"
#import "WHFishSpotDetailHV.h"
#import "WHFishSpotModel.h"
#import "ZWMSegmentView.h"
#import "WHFishSpotDetailFV.h"
#import "WHScollIngNoticeView.h"
#import "ZWMSegmentController.h"
#import "WHIntroduceFishSpotVC.h"
#import "UIViewController+Sheet.h"
#import "FishingEventViewController.h"
#import "WHFreedomFishVC.h"

@interface WHFishSpotDetailVC ()<WHFishSpotDetailHVDelegate,WHFishSpotDetailFVDelegate>

/*
 *
 */

@property (nonatomic,strong)WHFishSpotModel *model;
@property (nonatomic,strong)ZWMSegmentView *segmentView;
@property (nonatomic,strong)WHFishSpotDetailFV *footerView;
@property (nonatomic,strong)ZWMSegmentController *segmentVC;




@end

@implementation WHFishSpotDetailVC

-(instancetype)initWithModel:(WHFishSpotModel*)model
{
    self = [super init];
    if (self)
    {   self.model = model;
        self.title = self.model.name;
    }
    return self;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self setupUI];
   
}

-(void)setupUI
{
    WHFishSpotDetailHV *headerView = [[WHFishSpotDetailHV alloc]initWithFrame:CGRectMake(0,navHeight1, ScreenW,300) withModel:self.model];
    [self.view addSubview:headerView];
    headerView.delegate = self;
    
    WHScollIngNoticeView *noticeView = [[WHScollIngNoticeView alloc] initWithFrame:CGRectMake(20, navHeight1+300, ScreenW-40,60)];
    
    noticeView.titleText = @"最新消息";
    noticeView.moreButtonText = @"";
    noticeView.notices = @[@"1、钓场今天放鱼1000斤",@"2、第十届国际钓鱼大赛火热报名中",@"3、注意岸边是否稳固、湿滑，远离高压线等危险区域"];
    noticeView.textColor = [UIColor whiteColor];
    noticeView.font = [UIFont systemFontOfSize:15];
    noticeView.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:noticeView];
    [noticeView startScrolling];
    
    [self setupChildViewControllers];
    
    [self.view addSubview:self.footerView];
    self.footerView.delegate = self;
}

- (void)setupChildViewControllers{
    
    NSMutableArray *vcArray = [NSMutableArray new];
   
    NSArray *titleArray = @[@"随到随钓",@"定时定场",@"赛事活动"];
    
    CGFloat segmentViewHeight = ScreenH-(navHeight1+450);
    
    
    WHFreedomFishVC*vc1 = [[WHFreedomFishVC alloc]initWithHeight:segmentViewHeight];
    [vcArray addObject:vc1];
    
    
    WHFreedomFishVC*vc2 = [[WHFreedomFishVC alloc]initWithHeight:segmentViewHeight];
    [vcArray addObject:vc2];
    
    FishingEventViewController*fvc = [[FishingEventViewController alloc]initWithHeight:segmentViewHeight];
    [vcArray addObject:fvc];
    
    for(int i=0;i<titleArray.count;i++)
    {
        
    }
    
    self.segmentVC = [[ZWMSegmentController alloc] initWithFrame:CGRectMake(20, navHeight1+370,ScreenW-40,segmentViewHeight) titles:titleArray];
    
    self.segmentVC.segmentView.showSeparateLine =YES;
    self.segmentVC.segmentView.segmentTintColor =[UIColor blackColor];
    self.segmentVC.segmentView.backgroundColor =[UIColor whiteColor];
    self.segmentVC.viewControllers = vcArray;
    self.segmentVC.containerView.scrollEnabled =NO;
    self.segmentVC.segmentView.style=ZWMSegmentStyleDefault;
    [self addSegmentController:self.segmentVC];
    [self.segmentVC  setSelectedAtIndex:0];
}

-(void)wHFishSpotDetailHVBtnClick:(UIButton *)btn
{
    if (btn.tag ==1) {
        
        WHIntroduceFishSpotVC *vc = [[WHIntroduceFishSpotVC alloc] init];
      
        [self.navigationController pushViewController:vc animated:YES];
    }
    
}

-(void)wHFishSpotDetailFVBtnClick:(UIButton *)btn
{
    
    if (btn.tag ==1) {
        [self showActionSheet];
    }
}

-(WHFishSpotDetailFV *)footerView
{
    if (!_footerView) {
        
        _footerView = [[WHFishSpotDetailFV alloc]initWithFrame:CGRectMake(0,ScreenH-80,ScreenW,80)];
    }
    return _footerView;
}


@end
